<template>
  <a-spin :spinning="confirmLoading" style="background: #fff">
    <j-form-container :disabled="false">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row :gutter="48">
          <a-col :span="8" :hidden="true">
            <a-form-model-item label="流程名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bpmBizTitle" >
              <a-input :max-length="255" :disabled="formDisabled" v-model="model.bpmBizTitle" placeholder="请输入流程名称"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="单据编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="htbh">
              <a-input :disabled="true" v-model="model.htbh" placeholder="请输入单据编号"></a-input>
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="申请时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTime">
              <j-date :disabled="true" placeholder="请选择申请时间" v-model="model.createTime" style="width: 100%"/>
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="申请人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="proposer">
              <select-user-by-dep disabled :multi="false" v-model="model.proposer"/>
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="申请部门" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="proposerDeptId">
              <j-select-depart :disabled="true" v-model="model.proposerDeptId"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请人所属团队" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applyTeam">
              <select-team-input
                :disabled="formDisabled"
                v-model="model.applyTeam"
                :tdlx="1"/>
            </a-form-model-item>
          </a-col>

          <a-divider>基本信息</a-divider>
          <template v-if="sfbg">
            <a-col :span="8">
              <a-form-model-item label="合同编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="caId">
                <select-contract-manager-input
                  :htlx="contractType"
                  :disabled="formDisabled"
                  v-model="model.caId"
                  :allList="true"
                  :status="'2,3'"
                  :muitFlag="true"
                  :changeStatus="'unchanged'"
                  @change="htbhChange"
                  :triggerChange="true"/>
              </a-form-model-item>
            </a-col>
          </template>
          <a-col :span="8">
            <a-form-model-item label="合同名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="htmc">
              <a-input :disabled="formDisabled" v-model="model.htmc" placeholder="请输入合同名称"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="contractType == '2'">
            <a-form-model-item label="费用类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="feeType">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="list"
                v-model="model.feeType"
                dictCode="fee_type"
                placeholder="请选择费用类型"
                @input="handleFeeTypeChange"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="contractType == '2'">
            <a-form-model-item label="是否采购类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isCategoryType">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="radio"
                v-model="model.isCategoryType"
                dictCode="is_category_type"
                @input="handleChangeCategory"
                placeholder="请选择是否采购类"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" :hidden="showByHtlx && !detailFlag">
            <a-form-model-item label="合同类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="htlx" >
              <j-dict-select-tag
                :disabled="formDisabled ? true : sfbg"
                type="list"
                v-model="model.htlx"
                dictCode="htlx_type"
                placeholder="请选择合同类型"
                @change="htlxChange"
                :triggerChange="true"/>
            </a-form-model-item>
          </a-col>

          <template v-if="sfbg">
            <a-col :span="8">
              <a-form-model-item label="变更类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bglx">
                <j-dict-select-tag
                  :disabled="formDisabled"
                  type="list"
                  v-model="model.bglx"
                  dictCode="pay_contract_change_type"
                  placeholder="请选择变更类型"/>
              </a-form-model-item>
            </a-col>
          </template>
          <a-col :span="8">
            <a-form-model-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xmmc">
              <a-input
                v-if="formDisabled"
                readOnly
                @click.prevent="onDetail(model.xmmc)"
                v-model="model.xmmc_dictText"
                style="color: #1890FF; cursor: pointer;"
                placeholder="请选择项目"></a-input>
              <select-project-input
                v-else
                ref="projectModel"
                :disabled="model.lx == 2 || formDisabled"
                v-model="model.xmmc"
                :proDisabled="true"
                :projectStatus="'2'"
                currentProjectStatus="!2"
                isOldSystem="!1" 
                @change="xmmcChange"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-show="model.isCategoryType == '1'">
            <a-form-model-item label="采购类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="provisionType">
              <j-dict-select-tag
                @input="handleChangeProvisionType"
                type="list"
                dictCode="provision_type"
                :disabled="formDisabled"
                v-model="model.provisionType"
                placeholder="请选择采购类型" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-show="model.provisionType == '1'" >
            <a-form-model-item label="关联单据" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="calibrationId">
              <a-input
                v-if="formDisabled"
                readOnly
                @click.prevent="goPurchaseCalibrationDetail(model)"
                v-model="model.calibrationNo"
                style="color: #1890FF; cursor: pointer;"
                placeholder="请关联定标结果确认单"></a-input>
              <select-purchase-calibration-input v-else :disabled="formDisabled" placeholder="请关联定标结果确认单" v-model="model.calibrationId" :projectId="model.xmmc" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-show="model.provisionType == '2'" >
            <a-form-model-item label="关联单据" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="purchaseApplyId">
              <a-input
                v-if="formDisabled"
                readOnly
                @click.prevent="goPurchaseApplyDetail(model)"
                v-model="model.purchaseNo"
                style="color: #1890FF; cursor: pointer;"
                placeholder="请关联采购申请单"></a-input>
              <select-purchase-apply-form-contract-input v-else :disabled="formDisabled" placeholder="请关联采购申请单" v-model="model.purchaseApplyId" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-show="model.provisionType == '3'" >
            <a-form-model-item label="关联单据" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="invitationId">
              <a-input
                v-if="formDisabled"
                readOnly
                @click.prevent="goInvitationDetail(model)"
                v-model="model.invitationNo"
                style="color: #1890FF; cursor: pointer;"
                placeholder="请关联采购申请单"></a-input>
              <SelectPurchasingRequisitionInput v-else v-model="model.invitationId" placeholder="请关联招标采购申请单" :disabled="formDisabled" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" style="display:none">
            <a-form-model-item label="项目编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xmbh">
              <a-input :disabled="true" v-model="model.xmbh" placeholder="请输入项目编号"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <!-- 迭代16.7 选择经营费用的时候，单据中经营团队改成费用所属团队，弹窗团队选择； -->
            <a-form-model-item v-if="contractType == '2' && model.feeType=='2'" label="费用所属团队" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jytd">
              <select-team-input
               @back="changeVal"
                :disabled="formDisabled"
                v-model="model.jytd"
                :tdlx="1"/>
            </a-form-model-item>
            <a-form-model-item v-else label="经营团队" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jytd">
              <select-team-input
                @back="changeVal"
                :disabled="formDisabled"
                v-model="model.jytd"
                :tdlx="1"/>
            </a-form-model-item>
            <!-- <a-form-model-item label="经营公司" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="businessCompanyId">
              <select-Company-input :disabled="formDisabled" placeholder="请选择经营公司" v-model="model.businessCompanyId" disabled /> 
            </a-form-model-item> -->
          </a-col>
          <!-- <a-col :span="8">
            <a-form-model-item label="经营公司" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="businessCompanyId">
              <select-Company-input :disabled="formDisabled" placeholder="请选择经营公司" v-model="model.businessCompanyId" disabled /> 
            </a-form-model-item>
          </a-col> -->
          <a-col :span="8">
            <a-form-model-item label="业绩归属年度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yjgsnd">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="list"
                v-model="model.yjgsnd"
                dictCode="yjgsnd"
                placeholder="请选择业绩归属年度"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="签订单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qddw">
              <select-Company-input :disabled="formDisabled" v-model="model.qddw" placeholder="请选择签订单位"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="项目承接人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xmcjr">
              <select-user-by-dep :disabled="formDisabled" :multi="false" v-model="model.xmcjr"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="业主单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yzdw">
              <!-- <select-customer-input
                :disabled="formDisabled"
                v-model="model.yzdw"
                :commercialType="model.htlx"
                @change="yzdwChange"/> -->
              <!--迭代11 6.若合同类型为付款合同，业主单位改为取供应商改为待定-->
              <select-customer-input
                :disabled="formDisabled"
                v-model="model.yzdw"
                commercialType="1"
                @change="yzdwChange"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lxr">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="list"
                v-model="model.lxr"
                :dictCode="cust_lxr"
                placeholder="请选择联系人"
                @change="lxrChange"
                :triggerChange="true"/>

            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="联系方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lxfs">
              <a-input :disabled="formDisabled" v-model="model.lxfs" placeholder="请输入联系方式"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="签订日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qdrq">
              <j-date disabled placeholder="请选择签订日期" v-model="model.qdrq" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="履约保证金（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bail">
              <!--              <a-input  placeholder="请选择签订日期" v-model="model.bail" :defaultValue="0" />-->
              <a-input-number
                :disabled="formDisabled"
                :max="99999999"
                :min="0"
                :precision="2"
                v-model="model.bail"
                placeholder="请输入履约保证金"
                style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <div v-if="model.feeType === '1'">
              <a-form-model-item label="任务编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskId">
                  <SelectTaskFileInput
                    :disabled="formDisabled"
                    v-model="model.taskId"
                    :projectId="model.xmmc"
                    billType="contract"
                    @input="onTaskIdInput"
                  />
                </a-form-model-item>
            </div>
            <!-- <a-form-model-item label="任务档案编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-input placeholder="请输入任务档案编号" v-model="model.taskBillNo"></j-input>
            </a-form-model-item> -->
          </a-col>
          <template v-if="model.htlx==1">
            <a-col :span="8">
              <a-form-model-item
                label="分配方式"
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                prop="distributionMethod">

                <j-dict-select-tag
                  :disabled="formDisabled"
                  type="list"
                  v-model="model.distributionMethod"
                  @change="changeMoney"
                  dictCode="distribution_method"
                  placeholder="请选择分配方式"/>

              </a-form-model-item>
            </a-col>
          </template>
        </a-row>
        <a-row :gutter="48">
          <a-col :span="8">
            <!--迭代11 1.是否用章改为是否用印，变更为必选项，不给默认值 -->
            <a-form-model-item label="是否用印" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sfyz">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="radio"
                v-model="model.sfyz"
                dictCode="yn"
                @input="handleChangeSeal"
                placeholder="请选择是否用印"/>
            </a-form-model-item>
          </a-col>
          <template v-if="isShowSeal">
            <a-col :span="8" >
              <a-form-model-item label="用印类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="signSealWay">
                <j-dict-select-tag
                  :disabled="formDisabled"
                  type="select"
                  v-model="model.signSealWay"
                  dictCode="seal_way"
                  @input="handleChangeSignSealWay"
                  placeholder="请选择用印类型"/>
              </a-form-model-item>
            </a-col>
            <a-col :span="8" >
              <a-form-model-item label="印章类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yzlx">
                <j-multi-select-tag
                  :disabled="formDisabled"
                  type="select"
                  v-model="model.yzlx"
                  dictCode="yzlx_type"
                  placeholder="请选择印章类型"/>
              </a-form-model-item>
            </a-col>
            <a-col :span="8">
              <a-form-model-item label="用印份数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yyfs">
                <a-input-number
                  :disabled="formDisabled"
                  :max="99999999"
                  :min="0"
                  v-model="model.yyfs"
                  placeholder="请输入用印份数"
                  style="width: 100%"/>
              </a-form-model-item>
            </a-col>
          </template>
          <a-col :span="8">
            <!--迭代16.8 增加是否存档字段 -->
            <a-form-model-item label="是否存档" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sfcd">
              <j-dict-select-tag
                type="radio"
                v-model="model.sfcd"
                dictCode="yes_no"
                placeholder="请选择是否存档"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="model.sfcd==='1'">
            <!--迭代16.8 增加是否存档字段 -->
            <a-form-model-item label="合同存档份数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cdfs">
              <a-input-number
                :max="99999999"
                :min="0"
                v-model="model.cdfs"
                placeholder="请输入合同存档份数"
                style="width: 100%"
                disabled/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="48" v-if="!isShowSeal">
          <a-col :span="12">
            <a-form-model-item label="合同原件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="masterCopy">
              <j-upload v-if="!formDisabled" :disabled="formDisabled" v-model="model.masterCopy"></j-upload>
              <a-button v-else icon="download" @click="viewFile(model.masterCopy)">文件列表</a-button>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="48">
          <a-col :span="8" :hidden="model.htlx == '1'">
            <a-form-model-item label="关联收款合同" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="glskht">
              <j-dict-select-tag
                :disabled="formDisabled ? true : isFkht ? false : true"
                type="radio"
                v-model="model.glskht"
                dictCode="yn"
                placeholder="请选择关联收款合同"
                @change="glskhtChange"
                :triggerChange="true"/>
            </a-form-model-item>
          </a-col>
          <template v-if="glhtFlag">
            <a-col :span="8">
              <a-form-model-item label="收款合同名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="skhtmc">
                <select-contract-manager-input
                  :muitFlag="true"
                  :disabled="formDisabled"
                  v-model="model.skhtmc"
                  htlx="1"
                  @back="skhtBack"
                  :allList="true"
                  :triggerChange="true"/>
              </a-form-model-item>
            </a-col>
            <!--            <a-col :span="8">-->
            <!--              <a-form-model-item label="甲方" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jf">-->
            <!--                <select-Company-input :disabled="formDisabled" v-model="model.jf" placeholder="请选择甲方"/>-->
            <!--              </a-form-model-item>-->
            <!--            </a-col>-->
            <!--            <a-col :span="8">-->
            <!--              <a-form-model-item label="乙方" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yf">-->
            <!--                <select-customer-input :disabled="formDisabled" v-model="model.yf" commercialType="2"/>-->
            <!--              </a-form-model-item>-->
            <!--            </a-col>-->
            <a-col :span="8">
              <a-form-model-item label="收款合同额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="skhte">
                <a-input-number
                  disabled
                  :max="99999999"
                  :min="0"
                  v-model="model.skhte"
                  placeholder="请输入收款合同额"
                  style="width: 100%"
                  @blur="convertMoney1"/>
              </a-form-model-item>
            </a-col>
            <a-col :span="8">
              <a-form-model-item label="收款合同额大写" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="skhtedx">
                <a-input disabled v-model="model.skhtedx" placeholder="请输入收款合同额大写"></a-input>
              </a-form-model-item>
            </a-col>
          </template>
        </a-row>
        <a-row :gutter="48">
          <a-col :span="8">
            <a-form-model-item label="本次合同额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bchte">
              <a-input-number
                :precision="2"
                :disabled="formDisabled"
                :max="99999999"
                :min="0"
                v-model="model.bchte"
                placeholder="请输入本次合同额"
                style="width: 100%"
                @change="convertMoney2"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="本次合同额大写" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bchtedx">
              <a-input :disabled="true" v-model="model.bchtedx" placeholder="请输入本次合同额大写"></a-input>
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="8">
            <a-form-model-item label="服务期限开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fwqx">
              <j-date :disabled="formDisabled" placeholder="请选择服务期限开始时间" v-model="model.fwqx" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="服务期限结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fwqxEnd">
              <j-date :disabled="formDisabled" placeholder="请选择服务期限结束时间" v-model="model.fwqxEnd" style="width: 100%"/>
            </a-form-model-item>
          </a-col> -->
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="服务期限">
              <a-range-picker
                :disabled="formDisabled"
                :allowClear="false"
                v-model="createTime"
                style="width: 100%"
                @change="createTimeChange"/>
            </a-form-item>
          </a-col>
          <!-- <a-col :span="8">
            <a-form-model-item label="是否涉及多方信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="involveMultiple">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="radio"
                v-model="model.involveMultiple"
                @input="(val) => this.involveMultipleFlag = val == 1"
                dictCode="yes_no"
                placeholder="请选择是否涉及多方信息"/>
            </a-form-model-item>
          </a-col> -->

          <!-- 是否涉及多方信息为是时展示 -->
          <!--迭代11 去除是否涉及多方信息-->
          <!-- <template v-if="involveMultipleFlag"> -->
          <template>
            <a-divider style="top:20px;">{{ this.firstTitle }}</a-divider>
            <a-col :span="24">
              <div style="margin-bottom: 6px;margin-top: 6px">
                <a-button @click="handleAdd4" v-if="!formDisabled" type="primary">新增</a-button>
              </div>
              <a-table
                ref="table"
                size="middle"
                rowKey="id"
                :loading="loading"
                :columns="columns4"
                :pagination="false"
                :data-source="dataSource4">
                <span slot="action" slot-scope="text, record">
                  <template v-if="!formDisabled">
                    <a @click="handleEdit4(record)">编辑</a>
                    <a-divider type="vertical"/>
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete4(record.id)">
                      <a>删除</a>
                    </a-popconfirm>
                  </template>
                </span>
              </a-table>
            </a-col>

            <a-divider style="top:20px;">{{ this.secondTitle }}</a-divider>
            <a-col :span="24">
              <div style="margin-bottom: 6px;margin-top: 6px">
                <a-button @click="handleAdd3" v-if="!formDisabled" type="primary">新增</a-button>
              </div>
              <a-table
                ref="table"
                size="middle"
                rowKey="id"
                :loading="loading"
                :columns="columns3"
                :pagination="false"
                :data-source="dataSource3">
                <span slot="action" slot-scope="text, record">
                  <template v-if="!formDisabled">
                    <a @click="handleEdit3(record)">编辑</a>
                    <a-divider type="vertical"/>
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete3(record.id)">
                      <a>删除</a>
                    </a-popconfirm>
                  </template>
                </span>
              </a-table>
            </a-col>
          </template>
          <template v-if="contractType == '1'">
            <a-divider style="top:20px;">任务信息</a-divider>
            <template v-if="!detailFlag">
              <a-col :span="24">
                <j-vxe-table
                  ref="vTable"
                  row-number
                  keep-source
                  height="auto"
                  :loading="loading"
                  :dataSource="dataSource2"
                  :columns="columns2"
                  style="margin-top: 8px;"
                  @valueChange="handleValueChange"
                >
                  <template #htzb="{ row,rowIndex }">
                    <a-input-number
                      @change="handleJvxeChange($event,rowIndex,'htzb')"
                      :disabled="model.distributionMethod==2"
                      :max="99999999"
                      :min="0"
                      :precision="2"
                      v-model="row.htzb"
                      style="width: 100%" />
                  </template>
                  <template #fphte="{ row,rowIndex }">
                    <a-input-number
                      @change="handleJvxeChange($event,rowIndex,'fphte')"
                      :disabled="model.distributionMethod==1"
                      :max="99999999"
                      :min="0"
                      :precision="2"
                      v-model="row.fphte"
                      style="width: 100%" />
                  </template>
                </j-vxe-table>
              </a-col>
            </template>
            <template v-else>
              <a-col :span="24">
                <a-table
                  ref="table"
                  size="middle"
                  rowKey="id"
                  :loading="loading"
                  :columns="detailColumns"
                  :pagination="false"
                  :data-source="dataSource2">
                </a-table>
              </a-col>
            </template>
          </template>
          <a-divider style="top:20px;">收付款计划</a-divider>
          <template v-if="sfbg">
            <a-col :span="8">
              <a-form-model-item label="是否变更款项信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sfbgkxxx">
                <j-dict-select-tag
                  :disabled="formDisabled"
                  type="radio"
                  v-model="model.sfbgkxxx"
                  dictCode="yn"
                  :triggerChange="true"
                  @change="handleChangeSfbgkxxx"
                  placeholder="请选择是否变更款项信息"/>
              </a-form-model-item>
            </a-col>
          </template>

          <a-col :span="24">
            <div style="margin-bottom: 6px;margin-top: 6px" v-if="showKxxx">
              <a-button @click="handleAdd" v-if="!formDisabled" type="primary">新增</a-button>
            </div>
            <a-table
              ref="table"
              size="middle"
              rowKey="id"
              bordered
              :scroll="{x:scrollXOther}"
              :components="draggableComponentOther"
              :loading="loading"
              :columns="columns"
              :pagination="false"
              :data-source="dataSource">
              <span slot="action" slot-scope="text, record">
                <template v-if="!formDisabled && showKxxx">
                  <a @click="handleEdit(record)">编辑</a>
                  <span v-if="sfbg && !record.finalId ">
                    <a-divider type="vertical"/>
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                      <a >删除</a>
                    </a-popconfirm>
                  </span>
                </template>
              </span>
            </a-table>
          </a-col>

          <a-col :span="24">
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bz">
              <a-textarea :maxLength="500" :disabled="formDisabled" v-model="model.bz" rows="4" placeholder="请输入备注"/>
            </a-form-model-item>
          </a-col>

          <a-col :span="24">
            <a-form-model-item label="邮寄信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yjxx">
              <a-textarea :maxLength="500" :disabled="formDisabled" v-model="model.yjxx" rows="4" placeholder="请输入邮寄信息"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contractOrgFile">
                  <template v-slot:label>
                    <span >合同原件扫描件</span><span style="color: #faad14;font-weight: 600">（仅合同管理员上传！）</span>
                  </template>
                  <a-button icon="download" @click="viewFile(model.contractOrgFile)">文件列表</a-button>
                </a-form-model-item>
          </a-col>
          
          <a-col :span="24" v-if="model.sfyz == 1">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="signFile">
              <template v-slot:label>
                <span >用印文件</span><span style="color: #faad14;font-weight: 600">（请上传只需盖章的用印文件！）</span>
              </template>
              <j-upload
                v-if="!formDisabled"
                :disabled="formDisabled"
                v-model="model.signFile"
                :multiple="false"
                fileFormat=".pdf, .PDF, .doc, .docx"
                fileFormatText="请上传word与pdf格式的文件！"
                fileType="file"
                :fillSize="50"
                :isSingle="true"
              ></j-upload>
              <a-button v-else icon="download" @click="viewFile(model.signFile)">文件列表</a-button>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="相关附件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xgfj">
              <j-upload v-if="!formDisabled" :disabled="formDisabled" v-model="model.xgfj"></j-upload>
              <a-button v-else icon="download" @click="viewFile(model.xgfj)">文件列表</a-button>
            </a-form-model-item>
          </a-col>

          <!-- <a-col v-if="showFlowSubmitButton" :span="24" style="text-align: center">
            <a-button @click="submitForm">提 交</a-button>
          </a-col> -->
        </a-row>
      </a-form-model>
      <common-flow-list v-if="formBpm && model.bpmStatus !== '1'" :formData="formData" style="margin-top: 10px"></common-flow-list>
      <view-file-modal ref="viewFileModal"></view-file-modal>

      <!-- 项目详情开始 -->
      <erp-project-report-modal ref="projectModalForm"></erp-project-report-modal>
      <!-- 项目详情结束 -->
      <!--收付款计划-->
      <erp-omc-pay-contract-manager-plan-modal :htlx="model.htlx" :bchte="remainBchte" ref="itemList" @ok="modalFormOk"></erp-omc-pay-contract-manager-plan-modal>
      <erp-omc-contract-manager-class-modal ref="itemList2" @ok="modalFormOk2"></erp-omc-contract-manager-class-modal>
      <erp-omc-contract-manager-trustee-modal
        :htlx="model.htlx"
        :signSealWay="model.signSealWay"
        ref="itemList3"
        @ok="modalFormOk3"></erp-omc-contract-manager-trustee-modal>
      <erp-omc-contract-manager-entrust-modal
        :htlx="model.htlx"
        :signSealWay="model.signSealWay"
        ref="itemList4"
        @ok="modalFormOk4"></erp-omc-contract-manager-entrust-modal>
    </j-form-container>
    <a-row :gutter="48">
      <a-col :span="24" style="text-align: center;margin-top: 15px">
        <a-button type="primary" v-if="formBpm" :style="{ marginRight: showFlowSubmitButton?'10px':'0px' }" @click="onPrint">打印</a-button>
        <a-button @click="submitForm('submit')" v-if="showFlowSubmitButton">提 交</a-button>
      </a-col>
    </a-row>

    <ErpOmcPayContractManagerFormPrint v-if="formBpm" class="print_style" id="payContractmanageContent" :formData="model" :formDataHistory="formData"></ErpOmcPayContractManagerFormPrint>

    <ErpPurchaseCalibrationBillPenetrate ref="purchaseCalibrationBillPenetrate" ></ErpPurchaseCalibrationBillPenetrate>

    <ErpPurchaseApplyFormPenetrate ref="purchaseApplyFormPenetrate" ></ErpPurchaseApplyFormPenetrate>
    <ErpPurchaseApplyInvitationPenetrate ref="purchaseInvitationFormPenetrate" ></ErpPurchaseApplyInvitationPenetrate>
  </a-spin>
</template>

<script>
import { getAction, httpAction } from '@/api/manage'
import { viewFile } from '@/utils/util'
import SelectProjectInput from '@/views/scy/components/SelectProjectInput'
import SelectTeamInput from '@/views/scy/components/SelectTeamInput'
import SelectUserByDep from '@/views/scy/components/SelectUserByDep'
import SelectCustomerInput from '@/views/scy/components/SelectCustomerInput'
import SelectContractInput from '@/views/scy/components/SelectContractInput'
import { convertCurrency } from '@/utils/MoneyConvert'
import ViewFileModal from '@/views/scy/components/ViewFileModal'
import ErpOmcPayContractManagerPlanModal from '../modules/ErpOmcPayContractManagerPlanModal'
import ErpOmcContractManagerClassModal from '../modules/ErpOmcContractManagerClassModal'
import ErpOmcContractManagerTrusteeModal from '../modules/ErpOmcContractManagerTrusteeModal'
import ErpOmcContractManagerEntrustModal from '../modules/ErpOmcContractManagerEntrustModal'
import { filterMultiDictText, initDictOptions, filterDictTextByCache } from '@/components/dict/JDictSelectUtil'
import SelectContractManagerInput from '@/views/scy/components/SelectContractManagerInput'
import moment from 'moment';
import { mapGetters } from 'vuex';
import { message } from 'ant-design-vue'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
import SelectCompanyInput from '@/views/scy/components/SelectCompanyInput'
import SelectPurchaseCalibrationInput from '@/views/scy/components/SelectPurchaseCalibrationInput'
import CommonFlowList from '@/views/components/CommonFlowList.vue';
import ErpProjectReportModal from '@/views/erp/report/project/modules/ErpProjectReportModal'
import SelectPurchaseApplyFormContractInput from '@/views/scy/components/SelectPurchaseApplyFormContractInput'
import Print from '@/utils/print/printarea.js';
import ErpOmcPayContractManagerFormPrint from './ErpOmcPayContractManagerFormPrint' // 打印
import SelectPurchasingRequisitionInput from '@/views/scy/components/SelectPurchasingRequisitionInput'
import ErpPurchaseCalibrationBillPenetrate from '@/views/scy/penetrate/ErpPurchaseCalibrationBillPenetrate'
import ErpPurchaseApplyFormPenetrate from '@/views/scy/penetrate/ErpPurchaseApplyFormPenetrate'
import ErpPurchaseApplyInvitationPenetrate from '@/views/scy/penetrate/ErpPurchaseApplyInvitationPenetrate'
import { forEach } from 'lodash'
import SelectTaskFileInput from '@/views/scy/components/SelectTaskFileInput'; //  任务编号
import { DragResizable } from '@/mixins/DragResizable'
export default {
  name: 'ErpOmcPayContractManagerForm',
  mixins: [viewFile,DragResizable],
  components: { // select-customer-input
    SelectPurchaseApplyFormContractInput,
    SelectPurchaseCalibrationInput,
    SelectProjectInput,
    SelectTeamInput,
    SelectUserByDep,
    SelectCustomerInput,
    SelectContractInput,
    SelectTaskFileInput,
    ViewFileModal,
    ErpOmcPayContractManagerPlanModal,
    ErpOmcContractManagerClassModal,
    ErpOmcContractManagerTrusteeModal,
    ErpOmcContractManagerEntrustModal,
    SelectContractManagerInput,
    SelectCompanyInput,
    CommonFlowList,
    ErpProjectReportModal,
    ErpOmcPayContractManagerFormPrint,
    SelectPurchasingRequisitionInput,
    ErpPurchaseCalibrationBillPenetrate,
    ErpPurchaseApplyFormPenetrate,
    ErpPurchaseApplyInvitationPenetrate
  },
  props: {
    // 流程表单data
    formData: {
      type: Object,
      default: () => {
      },
      required: false
    },
    // 表单模式：true流程表单 false普通表单
    formBpm: {
      type: Boolean,
      default: false,
      required: false
    },
    // 表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false
    }
  },
  data() {
    return {
      model: {
        // 迭代11 1.是否用章改为是否用印，变更为必选项，不给默认值
        // sfyz: 0,
        glskht: 0,
        sfbgkxxx: 0,
        jf: undefined,
        yf: undefined,
        involveMultiple: 0
      },
      createTime: [],
      labelCol: {},
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 24 }
      },
      confirmLoading: false,
      validatorRules: {
        applyTeam: [
          { required: true, message: '请选择申请人所属团队!' }
        ],
        bchte: [
          { required: true, message: '请输入本次合同额!' }
        ],
        htlx: [
          { required: true, message: '请输入合同类型!' }
        ],
        htmc: [
          { required: true, message: '请输入合同名称!' }
        ],
        xmmc: [
          { required: true, message: '请选择项目名称!' }
        ],
        jytd: [
          { required: true, message: '请选择经营团队!' }
        ],
        yjgsnd: [
          { required: true, message: '请选择业绩归属年度!' }
        ],
        qddw: [
          { required: true, message: '请选择签订单位!' }
        ],
        xmcjr: [
          { required: true, message: '请选择项目承接人!' }
        ],
        yzdw: [
          { required: true, message: '请选择业主单位!' }
        ],
        // qdrq: [
        //   { required: true, message: '请输入签订日期!' }
        // ],
        yzlx: [
          { required: true, message: '请选择印章类型!' }
        ],
        signSealWay: [
          { required: true, message: '请选择用印类型!' }
        ],
        yyfs: [
          { required: true, message: '请填写用印份数!', trigger: 'blur' },
          { pattern: /^[0-9]*[1-9][0-9]*$/, message: '请输入正整数!' }
        ],
        lxfs: [
          { required: false },
          { pattern: /(^1\d{10}$|^(0\d{2,3}-?|\(0\d{2,3}\))?[1-9]\d{4,7}(-\d{1,8})?$)|(^\/$)/, message: '请输入正确的联系方式!' }
        ],
        masterCopy: [
          { required: true, message: '请上传合同原件!' }
        ],
        sfyz: [
          { required: true, message: '请选择是否用印!' }
        ],
        signFile: [
          { required: true, message: '请上传用印文件!' }
        ],
        feeType: [
          { required: true, message: '请选择费用类型!' }
        ],
        // sfcd: [
        //   { required: true, message: '请选择是否存档!' }
        // ],
        // cdfs: [
        //   { required: true, message: '请输入存档份数!' }
        // ],
        bail: [
          { required: true, message: '请输入履约保证金!', trigger: 'blur' }
          // { pattern: /^(0|[1-9]\d*)$/, message: '请输入正确的履约保证金!' }
        ],
        taskId: [
          { required: true, message: '请选择任务编号!', trigger: 'blur' }
          // { pattern: /^(0|[1-9]\d*)$/, message: '请输入正确的履约保证金!' }
        ]
      },
      url: {
        add: '/api/erp/omc/contractmanager/erpOmcContractManager/add',
        edit: '/api/erp/omc/contractmanager/erpOmcContractManager/edit',
        queryById: '/api/erp/omc/contractmanager/erpOmcContractManager/queryById',
        queryPlanList: '/api/erp/omc/contractmanager/erpOmcContractManagerPlan/listAll',
        queryClassList: '/api/erp/omc/contractmanager/erpOmcContractManagerClass/listAll',
        queryClassList2: '/api/erp/omc/project/erpOmcProjectTask/list',
        queryEntrustList: '/api/erp/omc/contractmanager/erpOmcContractManagerEntrust/listAll',
        queryTrusteeList: '/api/erp/omc/contractmanager/erpOmcContractManagerTrustee/listAll',
        queryProjectDeposit: '/api/erp/finance/deposit/erpFinanceProjectDepositBill/queryByEntity',
        generatedFormNumber: '/api/erp/base/generatedFormNumber',
        queryProjectById: '/api/erp/project/report/erpProjectReport/queryById',
        // 获取定标结果确认单信息
        queryCalibrationById: '/api/erp/purchase/procurement/erpPurchaseCalibration/queryById',
        // 获取采购申请单信息
        queryPurchaseApplyById: '/api/erp/purchase/procurement/erpPurchaseApplyForm/queryById',
        // 获取招标采购单信息
        queryInvitationById: '/api/erp/purchase/procurement/erpPurchaseApplyInvitation/queryById',
        queryProject: '/api/erp/omc/project/erpOmcProject/queryById'

      },
      loading: false,
      columns: [
        {
          title: '款项名称',
          align: 'center',
          dataIndex: 'kxmc',
          width: 188,
          ellipsis: true
        },
        {
          title: '金额(元)',
          align: 'center',
          dataIndex: 'je',
          width: 188,
          ellipsis: true
        },
        {
          // 3.收付款计划列表中的款项时间改为预计款项时间，为必填
          title: '预计款项日期',
          align: 'center',
          dataIndex: 'kxrq',
          width: 188,
          ellipsis: true
        },
        {
          title: '款项节点说明',
          align: 'center',
          dataIndex: 'kxjdsm',
          width: 188,
          ellipsis: true
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 150,
          scopedSlots: {
            filterDropdown: 'filterDropdown',
            filterIcon: 'filterIcon',
            customRender: 'action'
          }
        }
      ],
      columns2: [
        {
          title: '业务编码',
          align: 'center',
          key: 'ywfl'
          // formatter: ({ cellValue }) => {
          //   return cellValue ? filterMultiDictText(this.dictOptions['ywfl'], cellValue + '') : ''
          // }
        },
        {
          title: '业务名称',
          align: 'center',
          key: 'ywmc'
        },
        {
          title: '合同占比(%)',
          align: 'center',
          key: 'htzb',
          slotName: 'htzb',
          type: JVXETypes.slot
        },
        {
          title: '分配合同额（元）',
          align: 'center',
          key: 'fphte',
          slotName: 'fphte',
          type: JVXETypes.slot
        },
        {
          title: '生产团队',
          align: 'center',
          key: 'sctd_dictText'
          // formatter: ({ cellValue }) => {
          //   return cellValue ? filterMultiDictText(this.dictOptions['sctd'], cellValue + '') : ''
          // }
        },
        {
          title: '团队负责人',
          align: 'center',
          key: 'tdfzr_dictText'
          // formatter: ({ cellValue }) => {
          //   return cellValue ? filterMultiDictText(this.dictOptions['tdfzr'], cellValue + '') : ''
          // }
        }
      ],
      columns3: [
        {
          title: '名称',
          align: 'center',
          dataIndex: 'gsdaId',
          customRender: (text) => {
            if (!text) {
              return ''
            } else {
              return filterMultiDictText(this.dictOptions['gsda'], text + '')
            }
          }
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: {
            filterDropdown: 'filterDropdown',
            filterIcon: 'filterIcon',
            customRender: 'action'
          }
        }
      ],
      detailColumns: [
        {
          title: '业务编码',
          align: 'center',
          dataIndex: 'ywfl',
          width:146,
          ellipsis: true,
        },
        {
          title: '业务名称',
          align: 'center',
          dataIndex: 'ywmc',
          width:146,
          ellipsis: true,
        },
        {
          title: '合同占比(%)',
          align: 'center',
          dataIndex: 'htzb',
          width:146,
          ellipsis: true,
        },
        {
          title: '分配合同额（元）',
          align: 'center',
          dataIndex: 'fphte',
          width:146,
          ellipsis: true,
        },
        {
          title: '生产团队',
          align: 'center',
          dataIndex: 'sctd_dictText',
          width:146,
          ellipsis: true,
        },
        {
          title: '团队负责人',
          align: 'center',
          dataIndex: 'tdfzr_dictText',
          width:146,
          ellipsis: true,
        }
      ],
      columns4: [
        {
          title: '名称',
          align: 'center',
          dataIndex: 'khdaId',
          customRender: (text) => {
            if (!text) {
              return ''
            } else {
              return filterMultiDictText(this.dictOptions['khda'], text + '')
            }
          }
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: {
            filterDropdown: 'filterDropdown',
            filterIcon: 'filterIcon',
            customRender: 'action'
          }
        }
      ],
      contractType: '',
      dataSource: [], // 收付款计划数据源
      dataSource2: [], // 任务信息
      dataSource3: [], // 公司信息
      dataSource4: [], // 客户信息
      dictOptions: {},
      projectName: '',
      // 迭代11 委托方改为委托方(合同甲方)，受托方改为受托方（合同乙方）
      firstTitle: '委托方(合同甲方)信息',
      secondTitle: '受托方(合同乙方)信息',
      cust_lxr: '',
      glhtFlag: false,
      sfbg: false,
      detailFlag: false, // 查看详情状态
      isFkht: false,
      showKxxx: false,
      // 修改时加上当前行的值
      editRemain: 0,
      involveMultipleFlag: false,
      projectId: null,
      isNotHidden: false

    }
  },
  watch: {
    dataSource: {
      immediate: true,
      handler(val, old) {
        // this.remain = this.remainBchte;
      }
    }
  },
  computed: {
    getProject() {
      return this.model.xmmc
    },
    showByHtlx () {
      var type = this.contractType;
      if (type == '2') {
        this.$set(this.validatorRules, 'isCategoryType', [{ required: true, message: '请选择合同是否采购类!' }]);
      } else {
        this.$set(this, 'calibrationId', '');
        this.$delete(this.validatorRules, 'isCategoryType')
      }
      if (type == '1' || type == '2') {
        return true
      } else {
        return false
      }
    },
    formDisabled() {
      if (this.formBpm === true) {
        if (this.formData.disabled === false) {
          return false
        }
        return true
      }
      return this.disabled
    },
    showFlowSubmitButton() {
      if (this.formBpm === true) {
        if (this.formData.disabled === false) {
          return true
        }
      }
      return false
    },
    isShowSeal () {
      if (this.model.sfyz && this.model.sfyz == 1) {
        return true
      } else {
        return false
      }
    },
    // 合同额剩余可分配值
    remainBchte() {
      if (this.model.bchte) {
        let remain = this.model.bchte + this.editRemain;
        this.dataSource.forEach(data => {
          remain -= data.je;
        })
        return remain;
      } else {
        return 0;
      }
    }
  },
  created() {
    // 备份model原始值
    this.modelDefault = JSON.parse(JSON.stringify(this.model));
    // 如果是流程中表单，则需要加载流程表单data
    this.showFlowData();
    this.initDictConfig();
    if (this.formDisabled) {
      this.columns.pop()
      this.columns3.pop()
      this.columns4.pop()
    }
    this.otherKey = 'columns'
    this.customKey = 'detailColumns'
    this.columnswidth = this.columns.map(val => {
      return val.width
    })
    this.detailColumnswidth = this.detailColumns.map(val => {
      return val.width
    })
  },
  methods: {

    onTaskIdInput(item){
      let event = item.choseObj[0]
      if(event){
        this.$set(this.model, 'taskId', event.id)
        // this.$set(item, 'taskName', event.name)
      }
        
    },

    changeVal(val){
      this.$set(this.model, 'businessCompanyId',val[0].belongCompanyId)
    },

    goPurchaseCalibrationDetail(record) {
      this.$refs.purchaseCalibrationBillPenetrate.initData(record.calibrationId);
      this.$refs.purchaseCalibrationBillPenetrate.visible = true;
    },
    goPurchaseApplyDetail(record) {
      this.$refs.purchaseApplyFormPenetrate.initData(record.purchaseApplyId);
      this.$refs.purchaseApplyFormPenetrate.visible = true;
    },
    goInvitationDetail(record) {
      this.$refs.purchaseInvitationFormPenetrate.initData(record.invitationId);
      this.$refs.purchaseInvitationFormPenetrate.visible = true;
    },
    initDictConfig() {
      // initDictOptions('ywfx_type').then((res) => {
      //   if (res.success) {
      //     this.$set(this.dictOptions, 'ywfl', res.result)
      //   }
      // })
      initDictOptions('erp_omc_team_manager,alias_name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'sctd', res.result)
        }
      })
      initDictOptions('erp_employee_file,name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'tdfzr', res.result)
        }
      })
      initDictOptions('erp_purchase_supplier,enterprise_name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'khda', res.result)
        }
      })

      initDictOptions('erp_company_files,file_name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'gsda', res.result)
        }
      })
    },
    handleAdd() {
      this.$refs.itemList.add();
      this.$refs.itemList.title = '新增';
      this.$refs.itemList.disableSubmit = false;
      // this.isFkht = false;
      this.isFkht = true;
    },
    handleEdit(record) {
      // 修改时将当前的值从remain中减去
      this.editRemain = record.je;
      this.$refs.itemList.edit(record);
      this.$refs.itemList.title = '修改';
      // 修改经营团队的必填校验提示信息
      this.changejytdValidatorMessage()
      this.$refs.itemList.disableSubmit = false;
    },
    handleDelete(id) {
      for (let i = 0; i < this.dataSource.length; i++) {
        if (this.dataSource[i].id == id) {
          this.dataSource.splice(i, 1);
        }
      }
    // 删除收付款计划时调用子表数据变化方法
    this.planDetailListChange()
    },
    handleAdd2() {
      this.$refs.itemList2.add();
      this.$refs.itemList2.title = '新增';
      this.$refs.itemList2.disableSubmit = false;
    },
    handleEdit2(record) {
      this.$refs.itemList2.edit(record);
      this.$refs.itemList2.title = '修改';
      this.$refs.itemList2.disableSubmit = false;
    },
    handleDelete2(id) {
      for (let i = 0; i < this.dataSource2.length; i++) {
        if (this.dataSource2[i].id == id) {
          this.dataSource2.splice(i, 1);
        }
      }
    },
    handleAdd3() {
      this.$refs.itemList3.add();
      this.$refs.itemList3.title = '新增';
      this.$refs.itemList3.disableSubmit = false;
    },
    handleEdit3(record) {
      this.$refs.itemList3.edit(record);
      this.$refs.itemList3.title = '修改';
      this.$refs.itemList3.disableSubmit = false;
    },
    handleDelete3(id) {
      for (let i = 0; i < this.dataSource3.length; i++) {
        if (this.dataSource3[i].id == id) {
          this.dataSource3.splice(i, 1);
        }
      }
    },
    handleAdd4() {
      this.$refs.itemList4.add();
      this.$refs.itemList4.title = '新增';
      this.$refs.itemList4.disableSubmit = false;
    },
    handleEdit4(record) {
      this.$refs.itemList4.edit(record);
      this.$refs.itemList4.title = '修改';
      this.$refs.itemList4.disableSubmit = false;
    },
    handleDelete4(id) {
      for (let i = 0; i < this.dataSource4.length; i++) {
        if (this.dataSource4[i].id == id) {
          this.dataSource4.splice(i, 1);
        }
      }
    },
    // 收付款计划的修改和新增回调
    modalFormOk(data) {
      this.loading = true;
      let flag = true;
      // debugger;
      for (let i = 0; i < this.dataSource.length; i++) {
        if (this.dataSource[i].id == data.id) {
          this.dataSource.splice(i, 1, data);
          flag = false;
        }
      }
      if (flag) {
        this.dataSource.push(data);
      }
      this.planDetailListChange()
      this.loading = false;
    },
    modalFormOk2(data) {
      if (!data.ywmc) return false // 如果没有填写数据
      this.loading = true;
      let flag = true;
      // debugger;
      for (let i = 0; i < this.dataSource2.length; i++) {
        if (this.dataSource2[i].ywfl == data.ywfl) {
          this.dataSource2.splice(i, 1, data);
          flag = false;
        }
      }
      if (flag) {
        this.dataSource2.push(data);
      }
      this.loading = false;
    },
    modalFormOk3(data) {
      this.loading = true;
      let flag = true;
      // debugger;
      for (let i = 0; i < this.dataSource3.length; i++) {
        if (this.dataSource3[i].id == data.id) {
          this.dataSource3.splice(i, 1, data);
          flag = false;
        }
      }
      if (flag) {
        this.dataSource3.push(data);
      }
      this.loading = false;
    },
    modalFormOk4(data) {
      this.loading = true;
      let flag = true;
      // debugger;
      for (let i = 0; i < this.dataSource4.length; i++) {
        if (this.dataSource4[i].id == data.id) {
          this.dataSource4.splice(i, 1, data);
          flag = false;
        }
      }
      if (flag) {
        this.dataSource4.push(data);
      }
      this.loading = false;
      this.initDictConfig()
    },
    yzdwChange() {
      this.$set(this.model, 'lxr', undefined);
      this.$set(this.model, 'lxfs', undefined);
      // this.cust_lxr = erp_omc_customer_manager_contact,lxr,id;
      this.cust_lxr = 'erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id=\'' + this.model.yzdw + '\'';
      // this.$set(this.model, 'lxr', undefined);
      // this.$set(this.model, 'lxfs', undefined);
    },
    lxrChange(val) {
      // debugger
      getAction('/api/erp/omc/customermanager/erpOmcCustomerManagerContact/queryById', { id: val }).then((res) => {
        if (res.success) {
          let data = res.result.records || res.result
          // debugger;
          // this.model.lxdh = data.lxfs;
          this.$set(this.model, 'lxr', val)
          this.$set(this.model, 'lxfs', data.lxfs)
        }
      })
    },
    ...mapGetters(['userInfo']),
    add(type) {
      this.contractType = type
      this.dataSource = []
      this.dataSource2 = []
      this.dataSource3 = []
      this.dataSource4 = []
      this.modelDefault.lx = 1
      this.modelDefault.htlx = type
      this.sfbg = false;
      // this.model.createTime = moment().format('YYYY-MM-DD HH:mm:ss');
      // this.model.proposer = this.userInfo().empId;
      // this.model.proposerDeptId = this.userInfo().deptId;
      this.$set(this.modelDefault, 'proposer', this.userInfo().empId)
      this.$set(this.modelDefault, 'proposerDeptId', this.userInfo().deptId)
      this.$set(this.modelDefault, 'createTime', moment().format('YYYY-MM-DD HH:mm:ss'))
      this.edit(this.modelDefault);
      this.showKxxx = true;
      this.involveMultipleFlag = false;
      this.generatedFormNumber();
    },
    generatedFormNumber() {
      getAction(this.url.generatedFormNumber, { prefix: 'HT', subSystemCode: '05' }).then(res => {
        if (res.success) {
          this.$set(this.model, 'htbh', res.result)
        }
      })
    },
    add2(type) {
      this.contractType = type
      this.dataSource = []
      this.dataSource2 = []
      this.dataSource3 = []
      this.dataSource4 = []
      this.modelDefault.lx = 2
      this.sfbg = true
      this.modelDefault.htlx = type
      this.$set(this.modelDefault, 'proposer', this.userInfo().empId)
      this.$set(this.modelDefault, 'proposerDeptId', this.userInfo().deptId)
      this.$set(this.modelDefault, 'createTime', moment().format('YYYY-MM-DD HH:mm:ss'))
      this.edit(this.modelDefault);
      this.showKxxx = false;
      this.involveMultipleFlag = false;
      this.$set(this.validatorRules, 'sfyz', [{ required: true, message: '请选择是否用印!' }])
      this.generatedFormNumber();
    },
    async edit(record) {
      await this.$refs.form.resetFields();
      this.model = await Object.assign({}, record);
      this.$set(this.model, 'skhtedx', convertCurrency(this.model.skhte))
      this.$set(this.model, 'bchtedx', convertCurrency(this.model.bchte))
      // 根据ID获取定标结果确认单单号 用于穿透
      if (this.formDisabled && this.model.calibrationId) {
        getAction(this.url.queryCalibrationById, { id: this.model.calibrationId }).then(res => {
          this.$set(this.model, 'calibrationNo', res.result.purchaseBill);
        }).catch(e => {
          console.log(e)
        })
      }
      // 根据ID获取采购申请单单号 用于穿透
      if (this.formDisabled && this.model.purchaseApplyId) {
        getAction(this.url.queryPurchaseApplyById, { id: this.model.purchaseApplyId }).then(res => {
          this.$set(this.model, 'purchaseNo', res.result.purchaseBill);
        }).catch(e => {
          console.log(e)
        })
      }
      // 根据ID获取采购申请单单号 用于穿透
      if (this.formDisabled && this.model.invitationId) {
        getAction(this.url.queryInvitationById, { id: this.model.invitationId }).then(res => {
          this.$set(this.model, 'invitationNo', res.result.purchaseBill);
        }).catch(e => {
          console.log(e)
        })
      }
      if (record.lx == 2) {
        this.sfbg = true
        this.$set(this.validatorRules, 'caId', [{ required: true, message: '请选择合同编号!' }])
        this.$set(this.validatorRules, 'bglx', [{ required: true, message: '请选择变更类型!' }])
        this.$set(this.validatorRules, 'sfyz', [{ required: true, message: '请选择是否用印!' }])
      } else {
        this.sfbg = false;
        this.$delete(this.validatorRules, 'caId')
        this.$delete(this.validatorRules, 'bglx')
      }
      if (this.model && this.model.htlx) {
        if (this.model.isCategoryType) {
          this.handleChangeCategory(this.model.isCategoryType)
          if (this.model.provisionType) {
            this.handleChangeProvisionType(this.model.provisionType)
          }
        }
        this.contractType = this.model.htlx
        this.projectName = this.model.xmmc_dictText
        if (this.model.htlx === '1' || this.model.htlx === 1) { // 收款合同
          // 客户
          this.$refs.itemList4.isFk = true
          // 公司
          this.$refs.itemList3.isFk = false
          this.changeTitle(this.model.htlx)
        } else { // 付款合同
          // 客户
          this.$refs.itemList4.isFk = false
          // 公司
          this.$refs.itemList3.isFk = true
          this.changeTitle(this.model.htlx)
        }
      } else { // 默认
        // 客户
        this.$refs.itemList4.isFk = false
        // 公司
        this.$refs.itemList3.isFk = true
        this.changeTitle()
      }
      // 详情页去除表头中的操作
      if (this.formDisabled) {
        this.columns3.pop()
        this.columns4.pop()
      }
      this.$set(this, 'isFkht', this.model.htlx != '1')
      this.cust_lxr = 'erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id=\'' + this.model.yzdw + '\'';
      if (this.model.id) {
        // 收款计划
        getAction(this.url.queryPlanList, { mainId: this.model.id }).then((res) => {
          if (res.success) {
            this.dataSource = res.result || res.result.records
          }
        })

        // 任务信息 20230421 收款合同存在任务，付款合同删除任务
        if (this.contractType == '1') {
          getAction(this.url.queryClassList, { mainId: this.model.id }).then((res) => {
            if (res.success) {
              this.dataSource2 = res.result.records || res.result
              this.dataSource2.forEach((item, index) => {
                if (this.model.bchte) {
                  if (this.model.distributionMethod == 1) {
                    // 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
                    // item.fphte = parseFloat(item.htzb*0.01*parseFloat(this.model.bchte)).toFixed(2)
                    let amount = this.model.bchte * item.htzb / 100
                    item.fphte = Math.round((amount + Number.EPSILON) * 100) / 100
                  } else {
                    // 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
                    let rate = item.fphte / this.model.bchte * 100
                    item.htzb = Math.round((rate + Number.EPSILON) * 100) / 100;
                    // item.htzb = parseFloat(parseFloat(item.fphte) / parseFloat(this.model.bchte)*100).toFixed(2)
                  }
                } else {
                  if (this.model.distributionMethod == 1) {
                    // 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
                    item.fphte = 0
                  } else {
                    // 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
                    item.htzb = 0
                  }
                }
              })
            }
          })
        } else {
          this.dataSource2 = []
        }

        // 公司信息
        getAction(this.url.queryTrusteeList, { mainId: this.model.id }).then((res) => {
          if (res.success) {
            this.dataSource3 = res.result.records || res.result
          }
        })

        // 客户信息
        getAction(this.url.queryEntrustList, { mainId: this.model.id }).then((res) => {
          if (res.success) {
            this.dataSource4 = res.result.records || res.result
          }
        })
        this.showKxxx = this.model.lx == 2 ? this.model.sfbgkxxx == '1' : true
        this.glhtFlag = this.model.glskht == '1'
      }
  //    this.model.createTime = moment().format('YYYY-MM-DD HH:mm:ss');
      // this.cust_lxr = 'erp_omc_customer_manager_contact,lxr,id';
      // this.cust_lxr = 'erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id=\'' + this.model.yzdw + '\'';
      this.involveMultipleFlag = record.involveMultiple == 1
      // 服务期限
      if (!!this.model.fwqx && !!this.model.fwqxEnd) {
        this.createTime = []
        this.createTime.push(this.model.fwqx)
        this.createTime.push(this.model.fwqxEnd)
      } else {
        this.createTime = []
      }
      if (this.contractType == '1') {
        this.$set(this.validatorRules, 'distributionMethod', [{ required: true, message: '请选择分配方式!' }])
      } else {
        this.$delete(this.validatorRules, 'distributionMethod')
      }
      this.skhtmcRequire(this.model.glskht)
      this.visible = true;
      this[this.otherKey].forEach((val,index) => {
        val.width = this[this.otherKey+'width'][index]
      })
      this[this.customKey].forEach((val,index) => {
        val.width = this[this.customKey+'width'][index]
      })
    },
    // 渲染流程表单数据
    showFlowData() {
      if (this.formBpm === true) {
        let params = { id: this.formData.dataId };
        getAction(this.url.queryById, params).then((res) => {
          if (res.success) {
            this.detailFlag = true;
            this.edit(res.result);
          }
        });
      }
    },
    valdateContractMoney() {
      let planSum = 0;
      this.dataSource.forEach(data => {
        planSum += data.je;
      });
      // 迭代11 TASK#3763 2.收付款计划栏金额与合同总金额不对等时不可以发起，需要校验核对收付款计划金额和合同总金额
      if (this.model.bchte.toFixed(2) != planSum.toFixed(2)) {
        message.warning('计划总金额与合同金额不对等!')
        return false;
      }
      // 付款合同的本次合同额应该只是对外的任务的金额，不能校验本次合同额等于所有任务的总额
      if (this.model.htlx === 1 || this.model.htlx === '1') {
        if (this.model.distributionMethod == 1) {
          let rate = 0
          this.dataSource2.forEach(val => {
            rate += parseFloat(val.htzb)
          })
          if (rate != 100) {
            message.warning('合同占比相加不等于100%，请重新填写')
            return false;
          }
        } else {
          let total = 0
          this.dataSource2.forEach(val => {
            total += parseFloat(val.fphte)
          })
          if (total.toFixed(2) != parseFloat(this.model.bchte).toFixed(2)) {
            message.warning('所有分配金额总计和本次合同额不相等，请重新填写')
            return false;
          }
        }
      }
      return true;
    },
    onDetail(id) {
      const that = this
      this.$nextTick(() => {
        getAction(this.url.queryProjectById, { id }).then((res) => {
          if (res.success) {
            const model = res.result
            that.$refs.projectModalForm.getDetail(model);
            that.$refs.projectModalForm.title = '项目一览表';
          }
        })
      })
    },
    // 处理首付款计划，新增sortOrder字段
    handelPlanList(list) {
      for (let i = 0; i < list.length; i++) {
        list[i].sortOrder = i;
      }
      return list;
    },

    submitForm(type) {
      const that = this;
      if (type == 'draft') {
        // 代表保存草稿不做校验
        this.submit(type)
      } else if (type == 'submit') {
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {

            // 判断收款计划金额是否大于合同金额
            if (!this.valdateContractMoney()) {
              this.$emit('unButtonDisable');
              return;
            }
            // 迭代11 委托方和受托方列表需要校验两个分别必须至少有一条数据 是否为收付款单位有各且仅有一个
            if (!this.validateClientDetailAndTrusteeDetail()) {
              this.$emit('unButtonDisable');
              return;
            }
            if (that.model.htlx === 1 || that.model.htlx === '1') {
              if (that.dataSource.length === 0) {
                that.$message.warn('请填写收付款计划');
                that.confirmLoading = false
                that.$emit('unButtonDisable');
                return;
              }
            }
            that.submit(type)
          } else {
            that.$emit('unButtonDisable')
          }
        })
      } else {
        console.log('传参数，保存：draft，提交：submit')
      }
    },
    submit (type) {
      const that = this;
      that.confirmLoading = true;
      let httpurl = '';
      let method = '';
      if (!this.model.id) {
        httpurl += this.url.add;
        method = 'post';
      } else {
        httpurl += this.url.edit;
        method = 'put';
      }
      // 迭代11 标题修改
      that.model.bpmBizTitle = (this.projectName ? this.projectName + '-' : '') + that.userInfo().empName + (this.model.htbh ? ' - ' + this.model.htbh : '')
      let model = {};
      Object.assign(model, this.model)
      // if (model.bchte) {
        // this.$set(this.model,"yjhte",yjhte * 100)
      //   model.bchte = model.bchte * 100;
      // }

      // 收付款计划
      model.planList = this.handelPlanList(this.dataSource);

      // for (let i = 0; i < model.planList.length; i++) {
      //   // debugger;
      //   model.planList[i].je = model.planList[i].je * 100
      // }

      model.classList = this.contractType == 1 ? this.dataSource2 : []
      // 公司
      model.trusteeList = this.dataSource3 || [];
      // 客户
      model.entrustList = this.dataSource4 || [];
      httpAction(httpurl, model, method).then(async(res) => {
        if (res.success) {

          if(type !== 'draft'){
            const verifyId = method === 'put' ? this.model.id : res.result
            const result = await getAction('/api/erp/omc/contractmanager/erpOmcContractManager/verify',{id:verifyId},'get')
            if(!result.success) {
               that.$message.warning(result.message)
               that.$emit('dialogClose')
               return
            }
          }

          that.$message.success(res.message);
          if (method == 'post') {
            that.model.id = res.result;
          }
          that.$emit('ok', type, that.model);
        } else {
          that.$message.warning(res.message);
          that.$emit('unButtonDisable');
        }
      }).catch((error) => {
        that.$emit('unButtonDisable', error);
      }).finally(() => {
        that.confirmLoading = false;
      })
    },
    convertMoney1() {
      let money = this.model.skhte
      this.$set(this.model, 'skhtedx', convertCurrency(money))
    },
    convertMoney2() {
      let money = this.model.bchte
      this.$set(this.model, 'bchtedx', convertCurrency(money))
      this.dataSource2.forEach((item, index) => {
        if (this.model.bchte) {
          if (this.model.distributionMethod == 1) {
            // 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
            // item.fphte = parseFloat(item.htzb*0.01*parseFloat(this.model.bchte)).toFixed(2)
            let amount = this.model.bchte * item.htzb / 100
            item.fphte = Math.round((amount + Number.EPSILON) * 100) / 100
          } else {
            // 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
            let rate = item.fphte / this.model.bchte * 100
            item.htzb = Math.round((rate + Number.EPSILON) * 100) / 100;
            // item.htzb = parseFloat(parseFloat(item.fphte) / parseFloat(this.model.bchte)*100).toFixed(2)
          }
        } else {
          if (this.model.distributionMethod == 1) {
            // 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
            item.fphte = 0
          } else {
            // 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
            item.htzb = 0
          }
        }
      })
    },
    // 切换项目 任务信息  数据占比信息改变
    changeMoney() {
      if (this.model.bchte && this.dataSource2.length) {
        this.dataSource2.forEach((item) => {
          if (this.model.distributionMethod == 1) {
            // 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
            // item.fphte = parseFloat(item.htzb*0.01*parseFloat(this.model.bchte)).toFixed(2)
            let amount = this.model.bchte * item.htzb / 100
            item.fphte = Math.round((amount + Number.EPSILON) * 100) / 100
          } else {
            // 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
            let rate = item.fphte / this.model.bchte * 100
            item.htzb = Math.round((rate + Number.EPSILON) * 100) / 100;
            // item.htzb = parseFloat(parseFloat(item.fphte) / parseFloat(this.model.bchte)*100).toFixed(2)
          }
        })
      }
    },
    handleValueChange(event) {
      const { rowIndex, columnIndex, value } = event
      if (this.model.bchte) {
        if (columnIndex == 3) {
          let amount = this.model.bchte * value / 100
          this.dataSource2[rowIndex].fphte = Math.round((amount + Number.EPSILON) * 100) / 100;
        } else if (columnIndex == 4) {
          let rate = value / this.model.bchte * 100
          this.dataSource2[rowIndex].htzb = Math.round((rate + Number.EPSILON) * 100) / 100;
        }
      }
    },
    handleJvxeChange(value, rowIndex, key) {
      if (this.model.bchte) {
        if (key == 'fphte') {
          let rate = value / this.model.bchte * 100
          this.dataSource2[rowIndex].htzb = Math.round((rate + Number.EPSILON) * 100) / 100;
        } else {
          let amount = this.model.bchte * value / 100
          this.dataSource2[rowIndex].fphte = Math.round((amount + Number.EPSILON) * 100) / 100;
        }
      } else {
        this.dataSource2[rowIndex].htzb = 0
        this.dataSource2[rowIndex].fphte = 0
      }
    },
    xmmcChange(val) {
      // 清空项目也清空带出来的定标结果确认单数据
      if (!val) {
        this.model.calibrationId = null
        // this.$set(this.model, 'taskId', '') 
      }
      getAction(this.url.queryProject, { id: val }).then((res) => {
        if (res.success) {
          let data = res.result.records || res.result
          this.$set(this.model, 'calibrationId', null) // 定标结果确认单
          this.$set(this.model, 'taskId', '') 
          this.$set(this.model, 'yzdw', data.ownerUnit) // 业主单位
          this.$set(this.model, 'bail', '0')
          // debugger;
          // this.model.lxdh = data.lxfs;
          this.$set(this.model, 'xmbh', data.finalNo) // 项目编号
          // 迭代16.7 选择灰色类型的团队不用带出团队
          if (this.model.feeType !== '2') {
            this.$set(this.model, 'jytd', data.oldTeamId ? data.oldTeamId : data.teamName) // 经营团队
            this.$set(this.model, 'businessCompanyId', data.businessCompanyId) // 经营公司
          } else {
            this.$set(this.model, 'jytd', null) // 经营团队
            this.$set(this.model, 'businessCompanyId', null) // 经营公司
            // 
          }
          this.$set(this.model, 'yjgsnd', data.year) // 业绩归属年度
          this.$set(this.model, 'qddw', data.signUnit) // 签定单位
          this.$set(this.model, 'xmcjr', data.undertaker) // 项目承接人
          this.$set(this.model, 'lxfs', data.contactTel) // 联系方式
          this.cust_lxr = 'erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id=\'' + this.model.yzdw + '\'';
          this.$set(this.model, 'lxr', data.contacts) // 联系人
          this.projectName = data.projectName
          // 收款合同查询任务信息
          if (this.contractType == '1') {
            // 任务信息
            getAction(this.url.queryClassList2, { pageNo:1,pageSize: 999,projectId: data.id, distributionType: '!cancel' }).then((res) => {
              this.dataSource2 = []
              if (res.success) {
                let data = res.result.records || res.result
                // debugger;
                for (let i = 0; i < data.length; i++) {
                  let d = {
                    'ywfl': data[i].categoryCode,
                    'ywmc': data[i].categoryName,
                    'htzb': data[i].contractRate,
                    'fphte': data[i].contractAmount,
                    'sctd': data[i].productTeam,
                    'sctd_dictText': data[i].productTeam_dictText,
                    'tdfzr': data[i].teamLeader,
                    'tdfzr_dictText': data[i].teamLeader_dictText,
                    'projectTaskId': data[i].id
                  };
                  //  相同任务分类只存在一条功能去除 2023年3月28日
                  this.dataSource2.push(d);
                  // let index = this.dataSource2.findIndex(item => item.ywfl == d.ywfl)
                  // if (index > -1) {
                  //   this.dataSource2.splice(index, 1, d)
                  // } else {
                  //   this.dataSource2.push(d);
                  // }
                }
                this.changeMoney()
              }
            })
            this.$set(this.model, 'distributionMethod', data.distributionMethod || '')
          } else {
            this.dataSource2 = []
          }
          var params = {
            preProjectId: data.id,
            feeCategory: '2',
            bpmStatus: '3'
          }
          // 查看项目保证金
          getAction(this.url.queryProjectDeposit, params).then((res) => {
            if (res.success) {
              let data = res.result.records || res.result
              this.$set(this.model, 'bail', data.remittanceAmount)
            }
          })
        }
      })
    },
    htlxChange(val) {
      this.$set(this.model, 'htlx', val)
      if (val) {
        let url;
        if (val === '1') {
          // 合同类型为收款合同，需要做特殊处理
          // updated  by wuzx at 2021/12/28 调整为立项底表查询,不带bpmStatus
          // 修改前:  url = '/api/erp/omc/project/erpOmcProjectApply/list2?bpmStatus=3&isSkht=true";
          // 修改后:
          url = '/api/erp/omc/project/erpOmcProject/list2?isSkht=true';
          this.$set(this.model, 'glskht', '0')
          this.glhtFlag = false;
          this.skhtmcRequire(this.model.glskht)
          // 将受托方子modal中的是否显示付款改为false
          this.$refs.itemList4.isFk = true
          this.$refs.itemList3.isFk = false
          this.changeTitle(val)
        } else {
          // 合同类型为付款合同，需要做特殊处理
          // updated by wuzx at 2021/12/28 调整为立项底表查询,不带bpmStatus
          // 修改前: url = '/api/erp/omc/project/erpOmcProjectApply/list2?bpmStatus=3&isSkht=false";
          // 修改后:
          url = '/api/erp/omc/project/erpOmcProject/list2?isSkht=false';
          // 将受托方子modal中的是否显示付款改为true
          this.$refs.itemList4.isFk = false
          this.$refs.itemList3.isFk = true
          this.changeTitle(val)
        }
        this.$set(this, 'isFkht', val !== '1');
        this.$refs.projectModel.loadData(url);
      }
      // 切换合同类型时清空委托方、受托方信息
      this.dataSource4 = [];
      this.dataSource3 = [];
    },
    glskhtChange(val) {
      this.$set(this.model, 'glskht', val)
      if (val) {
        this.skhtmcRequire(val)
        if (val === '1') {
          this.glhtFlag = true;
        } else {
          this.glhtFlag = false;
        }
      }
    },
    skhtmcRequire(val) {
      if (val == '1') {
        this.$set(this.validatorRules, 'skhtmc', [{ required: true, message: '请选择收款合同名称!' }]);
      } else {
        this.$set(this.model, 'skhtmc', '');
        this.$set(this.model, 'skhte', '');
        this.$set(this.model, 'skhtedx', '');
        this.$delete(this.validatorRules, 'skhtmc');
      }
    },
    changeTitle(args) {
       if (args == '1') { // 收款合同类型时
         this.firstTitle = '委托方(合同甲方)信息'
         this.secondTitle = '受托方(合同乙方)信息'
          // 修改列表表头
          this.$set(this, 'columns4', [
            {
              title: '名称',
              align: 'center',
              dataIndex: 'khdaId',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterMultiDictText(this.dictOptions['khda'], text + '')
                }
              }
            },
            {
              title: '是否为付款单位',
              align: 'center',
              dataIndex: 'isFk',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterDictTextByCache('yes_no', text)
                }
              }
            },
            {
              title: '对方是否电子签章',
              align: 'center',
              dataIndex: 'isSignSeal',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterDictTextByCache('yes_no', text)
                }
              }
            },
            {
              title: '对方盖章人',
              align: 'center',
              dataIndex: 'psnName'
            },
            {
              title: '联系方式',
              align: 'center',
              dataIndex: 'psnMobile'
            },
            {
              title: '操作',
              dataIndex: 'action',
              align: 'center',
              scopedSlots: {
                filterDropdown: 'filterDropdown',
                filterIcon: 'filterIcon',
                customRender: 'action'
              }
            }
            ])
            this.$set(this, 'columns3', [
            {
              title: '名称',
              align: 'center',
              dataIndex: 'gsdaId',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterMultiDictText(this.dictOptions['gsda'], text + '')
                }
              }
            },
            {
              title: '是否为收款单位',
              align: 'center',
              dataIndex: 'isSk',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterDictTextByCache('yes_no', text)
                }
              }
            },
            {
              title: '我方经办人',
              align: 'center',
              dataIndex: 'psnName'
            },
            {
              title: '联系方式',
              align: 'center',
              dataIndex: 'psnMobile'
            },
            {
              title: '操作',
              dataIndex: 'action',
              align: 'center',
              scopedSlots: {
                filterDropdown: 'filterDropdown',
                filterIcon: 'filterIcon',
                customRender: 'action'
              }
            }
          ])
       } else { // 付款合同类型时
         this.firstTitle = '受托方(合同乙方)信息'
         this.secondTitle = '委托方(合同甲方)信息'
         // 修改列表表头
          this.$set(this, 'columns4', [
            {
              title: '名称',
              align: 'center',
              dataIndex: 'khdaId',
              customRender: (text, record) => {
                if (!text) {
                  return ''
                } else {
                  return filterMultiDictText(this.dictOptions['khda'], text + '')
                }
              }
            },
            {
              title: '是否为收款单位',
              align: 'center',
              dataIndex: 'isSk',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterDictTextByCache('yes_no', text)
                }
              }
            },
            {
              title: '对方是否电子签章',
              align: 'center',
              dataIndex: 'isSignSeal',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterDictTextByCache('yes_no', text)
                }
              }
            },
            {
              title: '对方盖章人',
              align: 'center',
              dataIndex: 'psnName'
            },
            {
              title: '联系方式',
              align: 'center',
              dataIndex: 'psnMobile'
            },
            {
              title: '操作',
              dataIndex: 'action',
              align: 'center',
              scopedSlots: {
                filterDropdown: 'filterDropdown',
                filterIcon: 'filterIcon',
                customRender: 'action'
              }
            }
            ])
            this.$set(this, 'columns3', [
            {
              title: '名称',
              align: 'center',
              dataIndex: 'gsdaId',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterMultiDictText(this.dictOptions['gsda'], text + '')
                }
              }
            },
            {
              title: '是否为付款单位',
              align: 'center',
              dataIndex: 'isFk',
              customRender: (text) => {
                if (!text) {
                  return ''
                } else {
                  return filterDictTextByCache('yes_no', text)
                }
              }
            },
            {
              title: '我方经办人',
              align: 'center',
              dataIndex: 'psnName'
            },
            {
              title: '联系方式',
              align: 'center',
              dataIndex: 'psnMobile'
            },
            {
              title: '操作',
              dataIndex: 'action',
              align: 'center',
              scopedSlots: {
                filterDropdown: 'filterDropdown',
                filterIcon: 'filterIcon',
                customRender: 'action'
              }
            }
          ])
       }
    },
    htbhChange(val) {
      getAction('/api/erp/omc/contractmanager/erpOmcContractManagerFinal/queryById', { id: val }).then((res) => {
        if (res.success) {
          let data = res.result.records || res.result
          this.$set(this.model, 'caId', val)
          this.$set(this.model, 'bpmBizTitle', data.htmc) // 标题
          this.$set(this.model, 'htmc', data.htmc) // 合同名称
          this.$set(this.model, 'taskId', data.taskId) // 
          this.$set(this.model, 'htlx', data.htlx) // 合同类型
          // fix:BUG#4955 合同变更-当合同类型为付款合同，带出的委托方、受托方信息错误 start
          this.htlxChange(data.htlx)
          // fix:BUG#4955 合同变更-当合同类型为付款合同，带出的委托方、受托方信息错误 end
          this.$set(this.model, 'xmmc', data.xmmc) // 项目名称
          this.$set(this.model, 'jytd', data.jytd) // 经营团队
          this.$set(this.model, 'businessCompanyId', data.businessCompanyId) // 经营公司
          this.$set(this.model, 'yjgsnd', data.yjgsnd)// 业绩归属年度
          this.$set(this.model, 'qddw', data.qddw) // 签订单位
          this.$set(this.model, 'xmcjr', data.xmcjr) // 项目承认人
          this.$set(this.model, 'yzdw', data.yzdw)// 业主单位
          this.$set(this.model, 'lxr', data.lxr)// 联系人
          this.cust_lxr = 'erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id=\'' + this.model.yzdw + '\'';
          this.$set(this.model, 'lxfs', data.lxfs) // 联系方式
          this.$set(this.model, 'qdrq', data.qdrq)// 签订日期
          this.$set(this.model, 'sfyz', data.sfyz)// 是否用印
          this.$set(this.model, 'signSealWay', data.signSealWay)// 用印类型
          this.$set(this.model, 'signFile', data.signFile)// 用印文件
          this.$set(this.model, 'yzlx', data.yzlx) // 印章类型
          this.$set(this.model, 'yyfs', data.yyfs)// 用印份数
          this.$set(this.model, 'sfcd', data.sfcd)// 是否存档
          this.$set(this.model, 'cdfs', data.cdfs)// 存档份数
          this.$set(this.model, 'glskht', data.glskht) // 关联收款合同
          this.glhtFlag = data.glskht == '1'
          this.skhtmcRequire(data.glskht)
          this.$set(this.model, 'skhtmc', data.skhtmc) // 收款合同名称
          // this.$set(this.model, 'jf', data.yzdw) // 甲方
          this.$set(this.model, 'jf', data.jf)// 甲方
          this.$set(this.model, 'yf', data.yf)// 甲方
          // this.$set(this.model, 'yf', data.qddw) // 已方
          this.$set(this.model, 'skhte', data.skhte)// 收款合同额
          this.$set(this.model, 'skhtedx', data.skhtedx)// 收款合同额大写
          this.$set(this.model, 'feeType', data.feeType)// 费用类型
          this.$set(this.model, 'applyTeam', data.applyTeam || '') // 申请人所属团队
          this.$set(this.model, 'contractOrgFile', data.contractOrgFile || '') // 合同原件扫描
          let bchte = data.bchte;
          // if (data.bchte) {
          //   bchte = data.bchte / 100
          // }

          this.$set(this.model, 'bchte', bchte)
          this.$set(this.model, 'bchtedx', data.bchtedx)
          this.$set(this.model, 'fwqx', data.fwqx)
          this.$set(this.model, 'fwqxEnd', data.fwqxEnd)
          // 服务期限
          if (!!this.model.fwqx && !!this.model.fwqxEnd) {
            this.createTime = []
            this.createTime.push(this.model.fwqx)
            this.createTime.push(this.model.fwqxEnd)
          } else {
            this.createTime = []
          }
          this.$set(this.model, 'bz', data.bz) // 备注
          this.$set(this.model, 'yjxx', data.yjxx) // 邮寄信息
          this.$set(this.model, 'xgfj', data.xgfj) // 相关附件
          this.$set(this.model, 'htbh', data.htbh) // 合同编号
          this.$set(this.model, 'xmbh', data.xmbh) // 合同编号

          this.$set(this.model, 'isCategoryType', data.isCategoryType) // 是否采购类
          this.$set(this.model, 'provisionType', data.provisionType) // 采购类型
          this.$set(this.model, 'calibrationId', data.calibrationId) // 定标结果确认单
          this.$set(this.model, 'purchaseApplyId', data.purchaseApplyId) // 采购申请单
          this.$set(this.model, 'invitationId', data.invitationId) // 招标采购申请单
          this.handleChangeCategory(data.isCategoryType)
          if (data.isCategoryType == '1') {
            this.handleChangeProvisionType(data.provisionType)
          }
          this.$set(this.model, 'bglx', data.bglx)
          this.$set(this.model, 'sfbgkxx', data.sfbgkxx)
          // this.$set(this.model, 'proposer', data.proposer)
          // this.$set(this.model, 'proposerDeptId', data.proposerDeptId)
          this.$set(this, 'isFkht', data.htlx != '1')
          this.$set(this.model, 'involveMultiple', data.involveMultiple)
          this.$set(this, 'involveMultipleFlag', data.involveMultiple == 1)
          this.$set(this.model, 'masterCopy', data.masterCopy) // 合同原件
          this.$set(this.model, 'bail', '0')
          // this.yzdwChange();
          if (this.contractType == 1) {
            this.$set(this.model, 'distributionMethod', data.distributionMethod || '')
          }
          // 收款计划
          getAction('/api/erp/omc/contractmanager/erpOmcContractManagerPlanFinal/listAll', { mainId: val }).then((res) => {
            if (res.success) {
              this.dataSource = res.result.records || res.result
              if (this.dataSource.length > 0) {
                this.dataSource.forEach((item, index) => {
                  item.finalId = item.id
                })
              }
            }
          })
          var params = {
            preProjectId: data.xmmc,
            feeCategory: '2',
            bpmStatus: '3'
          }
          // 查看项目保证金
          getAction(this.url.queryProjectDeposit, params).then((res) => {
            if (res.success) {
              let data = res.result.records || res.result
              this.$set(this.model, 'bail', data.remittanceAmount)
            }
          })
          // 任务信息
          // getAction('/api/erp/omc/contractmanager/erpOmcContractManagerClassFinal/listAll', { mainId: val }).then((res) => {
          getAction('/api/erp/omc/project/erpOmcProjectTask/listById', { id: data.xmmc }).then((res) => {
            let source = res || []
            this.dataSource2 = []
            if (source.length) {
              for (let i = 0; i < source.length; i++) {
                let d = {
                  'ywfl': source[i].categoryCode,
                  'ywmc': source[i].categoryName,
                  'htzb': source[i].contractRate,
                  'fphte': source[i].contractAmount,
                  'sctd': source[i].productTeam,
                  'sctd_dictText': source[i].productTeam ? filterMultiDictText(this.dictOptions['sctd'], source[i].productTeam + '') : '',
                  'tdfzr': source[i].teamLeader,
                  'tdfzr_dictText': source[i].teamLeader ? filterMultiDictText(this.dictOptions['tdfzr'], source[i].teamLeader + '') : '',
                  'projectTaskId': source[i].id
                };
                this.dataSource2.push(d);
              }
            }
            // if (res.success) {
              // this.dataSource2 = res.result.records || res.result
              // this.dataSource2.forEach((item, index) => {
              //   item.finalId = item.id
              //   if (this.model.bchte && item.htzb) {
              //     let amount = this.model.bchte * item.htzb / 100
              //     item.fphte = Math.round((amount + Number.EPSILON) * 100) / 100;
              //   }
              // })
            // }
          }),
          // 项目赋值
          getAction(this.url.queryProject, { id: data.xmmc }).then((res) => {
            if (res.success) {
              let data = res.result.records || res.result
              this.$set(this, 'projectName', data.projectName); // 项目名称
            }
          }),
            // 受托方信息
            getAction('/api/erp/omc/contractmanager/erpOmcContractManagerTrusteeFinal/listAll', { mainId: val }).then((res) => {
              if (res.success) {
                this.dataSource3 = res.result.records || res.result
                this.dataSource3.forEach((item, index) => {
                  item.finalId = item.id
                })
              }
            }),
            // 委托方信息
            getAction('/api/erp/omc/contractmanager/erpOmcContractManagerEntrustFinal/listAll', { mainId: val }).then((res) => {
              if (res.success) {
                this.dataSource4 = res.result.records || res.result
                this.dataSource4.forEach((item, index) => {
                  item.finalId = item.id
                })
              }
            })
        }
      })
    },
    skhtBack (item) {
      // this.$set(this.model, 'skhtmc', item[0].id)
      this.$set(this.model, 'jf', item[0].qddw)
      this.$set(this.model, 'skhte', item[0].bchte)
      this.$set(this.model, 'skhtedx', item[0].bchtedx)
    },
    handleChangeSfbgkxxx(val) {
      this.$set(this.model, 'sfbgkxxx', val);
      this.$set(this, 'showKxxx', val == '1');
    },
    handleChangeSeal(val) {
      if (val == 0) {
        this.$set(this.validatorRules, 'masterCopy', [{ required: true, message: '请上传合同原件!' }]);
        if (this.dataSource3 && this.dataSource3.length) {
          this.dataSource3.forEach(value => {
            value.psnName = null
            value.psnMobile = null
            return value
          })
        }
        if (this.dataSource4 && this.dataSource4.length) {
          this.dataSource4.forEach(value => {
            value.isSignSeal = '0'
            value.psnName = null
            value.psnMobile = null
            return value
          })
        }
      } else {
        this.$set(this.model, 'masterCopy', '');
        this.$delete(this.validatorRules, 'masterCopy');
      }
      this.$set(this.model, 'signSealWay', null) // 置空电子签章
    },
    handleChangeSignSealWay (val) {
      if (val != 'online') {
        if (this.dataSource3 && this.dataSource3.length) {
          this.dataSource3.forEach(value => {
            value.psnName = null
            value.psnMobile = null
            return value
          })
        }
        if (this.dataSource4 && this.dataSource4.length) {
          this.dataSource4.forEach(value => {
            value.isSignSeal = '0'
            value.psnName = null
            value.psnMobile = null
            return value
          })
        }
      } else {
        if (this.dataSource4 && this.dataSource4.length) {
          this.dataSource4.forEach(value => {
            value.isSignSeal = '0'
            value.psnName = null
            value.psnMobile = null
            return value
          })
        }
      }
    },
    handleChangeCategory(val) {
      if (val == '1') {
        this.$set(this.validatorRules, 'provisionType', [{ required: true, message: '请选择采购类型!' }]);
      } else {
        this.$set(this.model, 'provisionType', null);
        this.$delete(this.validatorRules, 'provisionType');
        this.$set(this.model, 'purchaseApplyId', null);
        this.$delete(this.validatorRules, 'purchaseApplyId');
        this.$set(this.model, 'calibrationId', null);
        this.$delete(this.validatorRules, 'calibrationId');
        this.$set(this.model, 'invitationId', null);
        this.$delete(this.validatorRules, 'invitationId');
      }
    },
    handleChangeProvisionType(val) {
      if (val == '1') {
        this.$set(this.validatorRules, 'calibrationId', [{ required: true, message: '请选择定标结果确认单!' }]);
        // 清除采购申请单数据及校验
        this.$set(this.model, 'purchaseApplyId', null);
        this.$delete(this.validatorRules, 'purchaseApplyId');
        // 清除招标采购申请单数据及校验
        this.$set(this.model, 'invitationId', null);
        this.$delete(this.validatorRules, 'invitationId');
      } else if (val == '2') {
        this.$set(this.validatorRules, 'purchaseApplyId', [{ required: true, message: '请选择采购申请单!' }]);
        // 清除定标结果确认单数据及校验
        this.$set(this.model, 'calibrationId', null);
        this.$delete(this.validatorRules, 'calibrationId');
        // 清除招标采购申请单数据及校验
        this.$set(this.model, 'invitationId', null);
        this.$delete(this.validatorRules, 'invitationId');
      } else if (val == '3') {
        this.$set(this.validatorRules, 'invitationId', [{ required: true, message: '请选择招标采购申请单!' }]);
        this.$set(this.model, 'calibrationId', null);
        this.$delete(this.validatorRules, 'calibrationId');
        this.$set(this.model, 'purchaseApplyId', null);
        this.$delete(this.validatorRules, 'purchaseApplyId');
      } else {
        // 清除采购申请单数据及校验
        this.$set(this.model, 'purchaseApplyId', null);
        this.$delete(this.validatorRules, 'purchaseApplyId');
        // 清除招标采购申请单数据及校验
        this.$set(this.model, 'invitationId', null);
        this.$delete(this.validatorRules, 'invitationId');
        // 清除定标结果确认单数据及校验
        this.$set(this.model, 'calibrationId', null);
        this.$delete(this.validatorRules, 'calibrationId');
      }
    },
    changeBizTitle() {
      this.model.bpmBizTitle = this.model.htmc
    },
    // 收付款计划子表变化回调
    planDetailListChange() {
      console.log('收付款计划子表变化---》', this.dataSource)
    },
    // 服务期限开始时间 结束时间
    createTimeChange(date, dateString) {
      this.$set(this.model, 'fwqx', dateString[0] + ' 00:00:00')
      this.$set(this.model, 'fwqxEnd', dateString[1] + ' 23:59:59')
    },
    // 校验委托方和受托方子表数据合法性 委托方和受托方列表需要校验两个分别必须至少有一条数据 是否为收付款单位有各且仅有一个
    validateClientDetailAndTrusteeDetail() {
      if (this.model.htlx == '1') { // 收款合同 dataSource4 客户为委托方（付款）
        // 委托方(合同甲方)信息校验
        if (!!this.dataSource4 && this.dataSource4.length == 0) {
          message.warning('请填写委托方信息!')
          return false;
        } else {
          let hasFkList = this.dataSource4.filter(item => item.isFk == '1');
          if (hasFkList.length <= 0) {
            message.warning('委托方必须有一个付款单位!')
            return false;
          }
          // 判断当选择是否用印为是且用印类型是电子签章的时候判断是否填写了盖章人信息和联系方式信息
          // let psnName = this.dataSource4.filter(item => item.psnName);
          // let psnMobile = this.dataSource4.filter(item => item.psnMobile);
          if (this.isShowSeal && this.model.signSealWay == 'online') {
            // 当主表选择了电子签章
            for (var i = 0; i < this.dataSource4.length; i++) {
              if (this.dataSource4[i].isSignSeal && this.dataSource4[i].isSignSeal == 1) {
                if (!this.dataSource4[i].psnName || !this.dataSource4[i].psnMobile) {
                  message.warning('请填写委托方联系人和联系方式!')
                  return
                }
              }
            }
          }
        }
        // 受托方(合同乙方)信息校验
        if (!!this.dataSource3 && this.dataSource3.length == 0) { // 收款合同 dataSource3 公司为受托方（收款）
          message.warning('请填写受托方信息!')
          return false;
        } else {
          let hasSkList = this.dataSource3.filter(item => item.isSk == '1');
          if (hasSkList.length != 1) {
            message.warning('受托方有且仅有一个是收款单位!')
            return false;
          }
          // 判断当选择是否用印为是且用印类型是电子签章的时候判断是否填写了盖章人信息和联系方式信息
          let psnName = this.dataSource3.filter(item => !item.psnName);
          let psnMobile = this.dataSource3.filter(item => !item.psnMobile);
          if (this.isShowSeal && this.model.signSealWay == 'online') {
            // 当主表选择了电子签章
            if (psnName.length || psnMobile.length) {
              message.warning('请填写受托方联系人和联系方式!')
            return false;
            }
          }
        }
        return true;
      } else { // 付款合同 dataSource3 公司为委托方（付款）
        // 委托方(合同甲方)信息校验
        if (!!this.dataSource3 && this.dataSource3.length == 0) {
          message.warning('请填写委托方信息!');
          return false;
        } else {
          let hasFkList = this.dataSource3.filter(item => item.isFk == '1');
          if (hasFkList.length != 1) {
            message.warning('委托方有且仅有一个是付款单位!')
            return false;
          }
          // 判断当选择是否用印为是且用印类型是电子签章的时候判断是否填写了盖章人信息和联系方式信息
          let psnName = this.dataSource3.filter(item => !item.psnName);
          let psnMobile = this.dataSource3.filter(item => !item.psnMobile);
          if (this.isShowSeal && this.model.signSealWay == 'online') {
            // 当主表选择了电子签章
            if (psnName.length || psnMobile.length) {
              message.warning('请填写委托方联系人和联系方式!')
            return false;
            }
          }
        }
        // 受托方(合同乙方)信息校验
        if (!!this.dataSource4 && this.dataSource4.length == 0) {
          message.warning('请填写受托方信息!');
          return false;
        } else {
          let hasSkList = this.dataSource4.filter(item => item.isSk == '1');
          if (hasSkList.length != 1) {
            message.warning('受托方有且仅有一个是收款单位!')
            return false;
          }
          // 判断当选择是否用印为是且用印类型是电子签章的时候判断是否填写了盖章人信息和联系方式信息
          // let psnName = this.dataSource4.filter(item => item.psnName);
          // let psnMobile = this.dataSource4.filter(item => item.psnMobile);
          if (this.isShowSeal && this.model.signSealWay == 'online') {
            // 当主表选择了电子签章
            for (var i = 0; i < this.dataSource4.length; i++) {
              if (this.dataSource4[i].isSignSeal && this.dataSource4[i].isSignSeal == 1) {
                if (!this.dataSource4[i].psnName || !this.dataSource4[i].psnMobile) {
                  message.warning('请填写受托方联系人和联系方式!')
                  return
                }
              }
            }
          }
        }
        return true;
      }
    },

    // 点击打印
    onPrint () {
        let print = new Print({
          el: '#payContractmanageContent',
          popTitle: '项目付款合同申请详情 · 禾美环保',
          endCallback() {

          }
        })
      },
    /*
    * 费用类型修改的时候逻辑
    * 生产费用：把经营团队带出来
    * 经营费用：把费用所属团队清空
    * */
    handleFeeTypeChange() {
      // 修改经营团队的必填校验提示信息
      this.changejytdValidatorMessage()
      if (this.model.feeType === '2') { // 经营费用
        this.$set(this.model, 'jytd', null)
        this.$set(this.model, 'businessCompanyId', null)
        this.$set(this.model, 'taskId', '')
      } else { // 其他
        // 如果有项目自动带出项目中的经营团队
        if (this.model.xmmc) {
          getAction(this.url.queryProject, { id: this.model.xmmc }).then((res) => {
            if (res.success) {
              let data = res.result.records || res.result
              this.$set(this.model, 'jytd', data.oldTeamId?data.oldTeamId:data.teamName)
              this.$set(this.model, 'businessCompanyId', data.businessCompanyId)
            }
          })
        }
      }
    },
    // fix:BUG#7077 当费用类型为经营费用，费用所属团队必填项未填写，应提示“请选择费用所属团队”
    changejytdValidatorMessage() {
      if (!!this.validatorRules && !!this.validatorRules.jytd) {
        this.$refs.form.clearValidate('jytd');
        if (this.model.feeType === '2') { // 经营费用
          // 修改提示
          this.$set(this.validatorRules, 'jytd', [
            { required: true, message: '请选择费用所属经营团队!' }
          ])
        } else { // 其他
          // 修改提示
          this.$set(this.validatorRules, 'jytd', [
            { required: true, message: '请选择经营团队!' }
          ])
        }
      }
    }
  }
}
</script>
<style>
  @import "../../../../../utils/print.css";
.print_style{
  position: absolute;
  top: 0;
  z-index: -1111;
}
</style>
